package com.biomatch.controller;

import com.biomatch.domain.Teacher;
import com.biomatch.dto.TeacherAndCourses;
import com.biomatch.response.RestResponse;
import com.biomatch.response.RestResult;
import com.biomatch.service.TeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController("dance.teacherCourse")
@RequestMapping("/teacherCourse")
@Api(value = "街舞老师增加多个课程管理")
public class TeacherCousesController {

    @Autowired
    private TeacherService teacherService;

    @RequestMapping(value="/addTeacherCourse", method = RequestMethod.POST)
    @ApiOperation(value = "新增或更新舞种", response = Teacher.class, httpMethod = "POST")
    public RestResult<TeacherAndCourses> addTeacherCourse(@RequestBody TeacherAndCourses teacherAndCourses) {
        TeacherAndCourses result = teacherService.addTeacherCourse(teacherAndCourses);
        if (result == null) {
            return RestResponse.error("插入失败");
        } else {
            return RestResponse.success(result);
        }
    }

}
